我知道SAS有算术速记,允许用户替换以下笨重的陈述:
$('#PEsubmit').click(function(){
var Companyname = '';
var flg = 0;
var Startdate = '';
var enddate = '';
var path = '';
$('#PriorExperienceAdd tr').each(function () {
if (flg > 0) {
Companyname += $(this).find("td:eq(0)").find('input[type=text]').val();
Companyname +='&'
Startdate += $(this).find("td:eq(1)").find('input[type=text]').val();
Startdate += '~';
enddate += $(this).find("td:eq(2)").find('input[type=text]').val();
enddate += '#';
path += $(this).find("td:eq(3)").find('input[type=file]').val();
path += '%';
}
flg++;
});
if (Companyname.length > 1) {
Companyname = Companyname.substring(0, Companyname.length - 1);
}
if (Startdate.length > 1) {
Startdate = Startdate.substring(0, Startdate.length - 1);
}
if (enddate.length > 1) {
enddate = enddate.substring(0, enddate.length - 1);
}
if (path.length > 1) {
path = path.substring(0, path.length - 1);
}
var Pathdetails={
"CompName": Companyname,
"StartDate": Startdate,
"EndDate": enddate,
"Path": path,
};
$.ajax({
url: '@Url.Action("AddPriorExperience", "ProfileDetails")',
data: JSON.stringify(Pathdetails),
type: 'POST',
contentType: 'application/json; charset=utf-8',
success: function (data) {
}
});//ajaxends
});
public void AddPriorExperience(string CompName, string StartDate, String EndDate, string Path, string filename)
{
CheckUser Sessiondetails = new CheckUser();
int SessionRolevalue = Sessiondetails.CheckSessionuser();
if (SessionRolevalue != 0)
{
using (EMSOffshoreEntities DB = new EMSOffshoreEntities())
{
DB.Database.Connection.Open();
AccountModel AccModel = new AccountModel();
int loginId = Convert.ToInt32(Decrypt.AESDecryptstring(Convert.ToString(Session["LoginId"])));
int selectedUserId = Convert.ToInt32(Decrypt.AESDecryptstring(Convert.ToString(Session["SelectedUser"])));
List<Sp_GetPriorExperience_Result> PriExp = DB.Sp_GetPriorExperience(selectedUserId).ToList();
List<Sp_GetSelectedUserDetail_Result> userdet = DB.Sp_GetSelectedUserDetail(selectedUserId).ToList();
string Username = userdet.First().UserName;
AccModel.PriorExperience = PriExp;
CompName = CompName.Replace("undefined", "");
StartDate = StartDate.Replace("undefined", "");
EndDate = EndDate.Replace("undefined", "");
Path = Path.Replace("undefined", "");
Path = Path.Replace(" ", "");
string filetype="";
string[] pathspl = Path.Split('%');
string subPath = "~/Documents/PriorExperience/" + selectedUserId + "-" + Username + "/" + filetype + "/";
string filePath = System.Web.Configuration.WebConfigurationManager.AppSettings["BaseURL"] + "~/Documents/PriorExperience/" + selectedUserId + "-" + Username + "/" + filetype + "/";
bool exists = System.IO.Directory.Exists(Server.MapPath(subPath));
if (!exists)
System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
string rootFolderPath = Path;
rootFolderPath = rootFolderPath.Replace(System.Web.Configuration.WebConfigurationManager.AppSettings["BaseURL"], "");
string flpth = rootFolderPath;
flpth = flpth.Replace(@"\PriorExperience", "");
string subpath1 = Server.MapPath(subPath + filename);
subpath1 = subpath1.Replace(@"\PriorExperience", "");
if (System.IO.File.Exists(flpth))
{
System.IO.File.Move((flpth), (subpath1));
filePath = filePath + Path;
//objdoc.SP_DeleteBasicDocs(userid, Convert.ToInt32(id), loginid, filePath);
}
DB.Database.Connection.Close();
}
}
else
{
Redirect(ConfigurationManager.AppSettings["BaseUrl"] + "Account/Login");
}
}
这一个:
myclunkyvar = myclunkyvar + 1;
但是,我对使用它感到犹豫,因为我不知道这些限制,也找不到任何关于它的文档(SAS的简写搜索结果似乎与列表符号有关)。
我知道我可以自己解决这些问题,并且已经测试了这些问题的答案,但我希望得到第二个意见。
myclunkyvar + 1;
,*
,-
等。/
?由于
答案 0 :(得分:1)