public DeliveryAddressModel.CustAddress AddAddress(string custid, string fname1, string lname, string tagid1, string Countryid1, string sid, string cid, string addr1, string pinid1, string mobile1, string Email) { DeliveryAddressModel.CustAddress objadd = new DeliveryAddressModel.CustAddress(); try { string Insertdata = "Insert into CustomerAddress ([CustomerId] ,[FirstName] ,[LastName] ,[TagId] ,[CountryId] ,[StateId] ,[CityId] ,[Address] ,[MobileNo] ,[PinCode] ,[DOC] ,[DOM] ,[IsDeleted] ,[IsActive],[Email]) Values ('" + custid + "','" + fname1 + "','" + lname + "','" + tagid1 + "','" + Countryid1 + "','" + sid + "','" + cid + "','" + addr1 + "','" + mobile1 + "','" + pinid1 + "','" + dbc.getindiantime().ToString("dd-MMM-yyyy hh:mm:ss") + "','" + dbc.getindiantime().ToString("dd-MMM-yyyy hh:mm:ss") + "','0','1','" + Email + "')select SCOPE_IDENTITY();"; string dtdata = dbc.ExecuteSQLScaler(Insertdata).ToString(); int idlast = 0; int.TryParse(dtdata.ToString(), out idlast); if (idlast > 0) { objadd.Response = CommonString.successresponse; objadd.Message = CommonString.successmessage; objadd.LastId = idlast.ToString(); } else { objadd.Response = CommonString.DataNotFoundResponse; objadd.Message = CommonString.DataNotFoundMessage; objadd.LastId = ""; } return(objadd); } catch (Exception ee) { objadd.Response = CommonString.Errorresponse; objadd.Message = ee.StackTrace; return(objadd); } }
public DeliveryAddressModel.CustAddress AddAddressV4(string custid, string name, string tagId, string countryId, string sid, string cid, string pincode, string mobile, string Email, string areaid, string area, string buildingid, string building, string buildingNo, string landmark, string others = "") { DeliveryAddressModel.CustAddress objadd = new DeliveryAddressModel.CustAddress(); try { area = area.Replace("'", "''"); building = building.Replace("'", "''"); landmark = landmark.Replace("'", "''"); others = others == null ? string.Empty : others.Replace("'", "''"); name = name.Replace("'", "''"); buildingNo = buildingNo.Replace("'", "''"); string StateName = ""; string getState = "SELECT StateName FROM [dbo].[StateMaster] WHERE Id = " + sid; DataTable dtState = dbc.GetDataTable(getState); if (dtState.Rows.Count > 0) { StateName = dtState.Rows[0]["StateName"].ToString(); } string CityName = ""; string getCity = "SELECT CityName FROM [dbo].[CityMaster] WHERE Id = " + cid; DataTable dtCity = dbc.GetDataTable(getCity); if (dtState.Rows.Count > 0) { CityName = dtCity.Rows[0]["CityName"].ToString(); } if (areaid == "-1") { string[] para1 = { area, pincode, StateName, CityName, "0", "1", dbc.getindiantime().ToString("dd-MMM-yyyy hh:mm:ss") }; string areadata = "Insert into ZipCode ([Area] ,[zipcode] ,[State] ,[District] ,[IsDeleted] ,[IsActive],[CreatedOn]) Values (@1,@2,@3,@4,@5,@6,@7)select SCOPE_IDENTITY();"; int Val = dbc.ExecuteQueryWithParamsId(areadata, para1); areaid = Val.ToString(); } if (buildingid == "-1") { string zipcodeid = ""; string getZipCodeId = "SELECT Id FROM [dbo].[ZipCode] WHERE ZipCode = '" + pincode + "' AND Area=" + "'" + area + "'"; DataTable dtZipCodeId = dbc.GetDataTable(getZipCodeId); if (dtZipCodeId.Rows.Count > 0) { zipcodeid = dtZipCodeId.Rows[0]["Id"].ToString(); string[] para2 = { building, pincode, area, zipcodeid, "0", "1", dbc.getindiantime().ToString("dd-MMM-yyyy hh:mm:ss") }; string areadata = "Insert into tblBuilding ([Building] ,[zipcode] ,[Area] ,[ZipCodeId] ,[IsDeleted] ,[IsActive],[CreatedOn]) Values (@1,@2,@3,@4,@5,@6,@7)select SCOPE_IDENTITY();"; int Val = dbc.ExecuteQueryWithParamsId(areadata, para2); buildingid = Val.ToString(); } } string Insertdata = "Insert into CustomerAddress ([CustomerId] ,[FirstName],[TagId] ,[CountryId] ,[StateId] ,[CityId] ,[MobileNo] ,[PinCode] ," + " [DOC] ,[DOM] ,[IsDeleted] ,[IsActive],[Email],[AreaId],[BuildingId],[BuildingNo],[LandMark],[OtherDetail]) " + " Values ('" + custid + "','" + name + "','" + tagId + "','" + countryId + "','" + sid + "','" + cid + "','" + mobile + "','" + pincode + "','" + dbc.getindiantime().ToString("dd-MMM-yyyy hh:mm:ss") + "','" + dbc.getindiantime().ToString("dd-MMM-yyyy hh:mm:ss") + "','0','1','" + Email + "'," + areaid + "," + buildingid + ",'" + buildingNo + "','" + landmark + "','" + others + "')select SCOPE_IDENTITY();"; string dtdata = dbc.ExecuteSQLScaler(Insertdata).ToString(); int idlast = 0; int.TryParse(dtdata.ToString(), out idlast); if (idlast > 0) { objadd.Response = CommonString.successresponse; objadd.Message = CommonString.successmessage; objadd.LastId = idlast.ToString(); } else { objadd.Response = CommonString.DataNotFoundResponse; objadd.Message = CommonString.DataNotFoundMessage; objadd.LastId = ""; } return(objadd); } catch (Exception ee) { objadd.Response = CommonString.Errorresponse; objadd.Message = ee.StackTrace; return(objadd); } }