public IHttpActionResult AddTypeMaster(TypeMaster TypeMasterDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = repository.Insert(TypeMasterDetails); return(Ok(result)); }
public async Task <ServiceResponseModel <TypeMasterModel> > Add(TypeMasterModel newTypeMasterModel) { ServiceResponseModel <TypeMasterModel> serviceResponse = new ServiceResponseModel <TypeMasterModel>(); TypeMaster typeMaster = _mapper.Map <TypeMaster>(newTypeMasterModel); await UnitOfWork.TypeMasters.AddAsync(typeMaster); await UnitOfWork.Complete(); serviceResponse.Data = newTypeMasterModel; return(serviceResponse); }
public async Task <ServiceResponseModel <TypeMasterModel> > GetTypeByCode(TypeMasterModel editTypeMasterModel) { ServiceResponseModel <TypeMasterModel> serviceResponse = new ServiceResponseModel <TypeMasterModel>(); TypeMaster editTypeMaster = await UnitOfWork.TypeMasters.SingleOrDefaultAsync(t => t.CompCode == editTypeMasterModel.CompCode && t.AccYear == editTypeMasterModel.AccYear && t.TrxCd == editTypeMasterModel.TrxCd); TypeMasterModel typeMasterModelall = _mapper.Map <TypeMasterModel>(editTypeMaster); serviceResponse.Data = typeMasterModelall; return(serviceResponse); }
//public DataTable category_WSSelectAll() //{ // DataSet ds = new DataSet(); // SqlDataAdapter da; // try // { // SqlCommand cmd = new SqlCommand(); // cmd.CommandText = "Type_WSSelectAll"; // cmd.CommandType = CommandType.StoredProcedure; // cmd.Connection = ConnectionString; // ConnectionString.Open(); // da = new SqlDataAdapter(cmd); // da.Fill(ds); // } // catch (Exception ex) // { // ErrHandler.writeError(ex.Message, ex.StackTrace); // return null; // } // finally // { // ConnectionString.Close(); // } // return ds.Tables[0]; //} public TypeMaster SelectById(Int64 cid) { SqlDataAdapter da; DataSet ds = new DataSet(); TypeMaster objcategory = new TypeMaster(); try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Type_SelectById"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = ConnectionString; cmd.Parameters.AddWithValue("@id", cid); ConnectionString.Open(); da = new SqlDataAdapter(cmd); da.Fill(ds); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0] != null) { if (ds.Tables[0].Rows.Count > 0) { { objcategory.id = Convert.ToInt64(ds.Tables[0].Rows[0]["id"]); objcategory.typename = Convert.ToString(ds.Tables[0].Rows[0]["typename"]); objcategory.imagename = Convert.ToString(ds.Tables[0].Rows[0]["imagename"]); objcategory.actualprice = Convert.ToDecimal(ds.Tables[0].Rows[0]["actualprice"]); objcategory.discountprice = Convert.ToDecimal(ds.Tables[0].Rows[0]["discountprice"]); objcategory.shortdesc = Convert.ToString(ds.Tables[0].Rows[0]["shortdesc"]); objcategory.longdescp = Convert.ToString(ds.Tables[0].Rows[0]["longdescp"]); objcategory.bankid = Convert.ToInt32("0"); } } } } } } catch (Exception ex) { ErrHandler.writeError(ex.Message, ex.StackTrace); return(null); } finally { ConnectionString.Close(); } return(objcategory); }
public IHttpActionResult UpdateTypeMaster(int id, TypeMaster TypeMasterDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = repository.GetById(TypeMasterDetails.TypeId); if (result == null) { return(AddTypeMaster(TypeMasterDetails)); } result = repository.Update(TypeMasterDetails, id); return(Ok(result)); }
protected void btnSave_Click(object sender, EventArgs e) { Int64 Result = 0; TypeMaster objcategory = new TypeMaster(); objcategory.typename = txtCategoryName.Text.Trim(); objcategory.actualprice = 0; objcategory.discountprice = 0; objcategory.shortdesc = txtCategoryShortDescription.Text.Trim(); objcategory.longdescp = txtCategoryLongDescription.Text.Trim(); //objcategory.bankid = Convert.ToInt32(ddlBank.SelectedValue); if (ViewState["fileName"] != null) { objcategory.imagename = ViewState["fileName"].ToString(); } if (Request.QueryString["id"] != null) { objcategory.id = Convert.ToInt64(ocommon.Decrypt(Request.QueryString["id"].ToString(), true)); Result = (new Cls_Type_b().Update(objcategory)); if (Result > 0) { Clear(); Response.Redirect(Page.ResolveUrl("~/manageType.aspx?mode=u")); } else { Clear(); spnMessgae.Style.Add("color", "red"); spnMessgae.InnerText = "Type Not Updated"; BindCategory(Convert.ToInt64(ocommon.Decrypt(Request.QueryString["id"].ToString(), true))); } } else { Result = (new Cls_Type_b().Insert(objcategory)); if (Result > 0) { Clear(); Response.Redirect(Page.ResolveUrl("~/manageType.aspx?mode=i")); } else { Clear(); spnMessgae.Style.Add("color", "red"); spnMessgae.InnerText = "Type Not Inserted"; } } }
public async Task <ServiceResponseModel <TypeMasterModel> > Edit(TypeMasterModel editTypeMasterModel) { ServiceResponseModel <TypeMasterModel> serviceResponse = new ServiceResponseModel <TypeMasterModel>(); TypeMaster editTypeMaster = await UnitOfWork.TypeMasters.SingleOrDefaultAsync(t => t.CompCode == editTypeMasterModel.CompCode && t.AccYear == editTypeMasterModel.AccYear && t.TrxCd == editTypeMasterModel.TrxCd); _mapper.Map <TypeMasterModel, TypeMaster>(editTypeMasterModel, editTypeMaster); UnitOfWork.TypeMasters.Update(editTypeMaster); await UnitOfWork.Complete(); serviceResponse.Data = editTypeMasterModel; return(serviceResponse); }
public async Task <ServiceResponseModel <TypeMasterModel> > Delete(TypeMasterModel delTypeMasterModel) { ServiceResponseModel <TypeMasterModel> serviceResponse = new ServiceResponseModel <TypeMasterModel>(); TypeMaster delTypeMaster = await UnitOfWork.TypeMasters.SingleOrDefaultAsync(t => t.CompCode == delTypeMasterModel.CompCode && t.AccYear == delTypeMasterModel.AccYear && t.TrxCd == delTypeMasterModel.TrxCd); UnitOfWork.TypeMasters.Remove(delTypeMaster); await UnitOfWork.Complete(); TypeMasterModel delCgstMasterModel = _mapper.Map <TypeMasterModel>(delTypeMaster); serviceResponse.Data = delCgstMasterModel; return(serviceResponse); }
// Use this for initialization void Start() { bigPicture = GameObject.Find("BigPicture"); helpText = GameObject.Find("HelpText"); driverState = GameDriverState.Start; pc = GameObject.Find("PulseController").GetComponent<PulseController>(); tm = GameObject.Find("TypeMaster").GetComponent<TypeMaster>(); gameState = GameObject.Find("GameState").GetComponent<GameState>(); if (gameState.gameConfig != null) { bigPicture.GetComponent<Renderer>().material.SetTexture("_MainTex", gameState.gameConfig.bigTexture); GameObject heart = bigPicture.transform.Find("Heart").gameObject; heart.transform.localPosition = gameState.gameConfig.heartOffset; float n = gameState.gameConfig.heartScale; heart.transform.localScale = new Vector3(n, n, n); } }
public Int64 Update(TypeMaster objTypeMaster) { Int64 result = 0; try { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Type_Update"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = ConnectionString; SqlParameter param = new SqlParameter(); param.ParameterName = "@id"; param.Value = objTypeMaster.id; param.SqlDbType = SqlDbType.BigInt; param.Direction = ParameterDirection.InputOutput; cmd.Parameters.Add(param); cmd.Parameters.AddWithValue("@typename", objTypeMaster.typename); cmd.Parameters.AddWithValue("@imagename", objTypeMaster.imagename); cmd.Parameters.AddWithValue("@actualprice", objTypeMaster.actualprice); cmd.Parameters.AddWithValue("@discountprice", objTypeMaster.discountprice); cmd.Parameters.AddWithValue("@shortdesc", objTypeMaster.shortdesc); cmd.Parameters.AddWithValue("@longdescp", objTypeMaster.longdescp); //cmd.Parameters.AddWithValue("@bankid", objcategory.bankid); ConnectionString.Open(); cmd.ExecuteNonQuery(); result = Convert.ToInt64(param.Value); } catch (Exception ex) { ErrHandler.writeError(ex.Message, ex.StackTrace); return(result); } finally { ConnectionString.Close(); } return(result); }
//private void BindBank() //{ // DataTable dtBank = (new Cls_bankmaster_b().SelectAll()); // if (dtBank != null) // { // if (dtBank.Rows.Count > 0) // { // ddlBank.DataSource = dtBank; // ddlBank.DataTextField = "bankname"; // ddlBank.DataValueField = "bankid"; // ddlBank.DataBind(); // ListItem objListItem = new ListItem("--Select Bank--", "0"); // ddlBank.Items.Insert(0, objListItem); // } // } //} public void BindCategory(Int64 CategoryId) { TypeMaster objcategory = (new Cls_Type_b().SelectById(CategoryId)); if (objcategory != null) { //ddlBank.SelectedValue = objcategory.bankid.ToString(); txtCategoryName.Text = objcategory.typename; txtCategoryShortDescription.Text = objcategory.shortdesc; txtCategoryLongDescription.Text = objcategory.longdescp; if (!string.IsNullOrEmpty(objcategory.imagename)) { imgCategory.Visible = true; ViewState["fileName"] = objcategory.imagename; imgCategory.ImageUrl = categoryFrontPath + objcategory.imagename; btnImageUpload.Visible = false; btnRemove.Visible = true; } else { btnImageUpload.Visible = true; } } }
// Use this for initialization void Start() { health = maxHealth; beats = new List<GameObject>(); markPosition = transform.Find("PulseMark").transform.localPosition.x; bgMat = transform.Find("PulseBackground").GetComponent<LineRenderer>().material; gameState = GameObject.Find("GameState").GetComponent<GameState>(); gameDriver = GameObject.Find("GameDriver").GetComponent<GameDriver>(); tm = GameObject.Find("TypeMaster").GetComponent<TypeMaster>(); heart = GameObject.Find("Heart"); if (gameState.gameConfig != null) beatDelay = 60f / gameState.gameConfig.rate; }
/// <summary> /// Save voucher with detail /// </summary> /// <param name="newVoucherMasterModel"></param> /// <returns></returns> public async Task <ServiceResponseModel <VoucherMasterModel> > Add(VoucherMasterModel newVoucherMasterModel) { String autoVoucher = null; string voucherNo = null; int vouno = 1; int itemSr = 1; decimal mtot = 0; Ledger ledger = null; List <Ledger> ledgersRec = new List <Ledger>(); VoucherDetailModel voucherDetailModel = null; AccountMaster accountMaster = null; ServiceResponseModel <VoucherMasterModel> serviceResponse = new ServiceResponseModel <VoucherMasterModel>(); try { // autovoucher? CompInfo compInfo = await UnitOfWork.Companies.SingleOrDefaultAsync(c => c.CompCode == newVoucherMasterModel.CompCode); if (null != compInfo) { autoVoucher = compInfo.AutoVoucher; } else { throw new Exception(string.Format("{0}{1}", "Company object missing from table CompInfo:", newVoucherMasterModel.CompCode)); } if (autoVoucher.ToUpper() == "Y") { //Generate auto voucher TypeMaster typeMaster = await UnitOfWork.TypeMasters.SingleOrDefaultAsync(t => t.CompCode == newVoucherMasterModel.CompCode && t.AccYear == newVoucherMasterModel.AccYear && t.TrxCd == newVoucherMasterModel.TrxType); if (null != typeMaster) { vouno = typeMaster.ItemSr == null ? 1 : (int)typeMaster.ItemSr + 1; typeMaster.ItemSr = vouno; UnitOfWork.TypeMasters.Update(typeMaster); } else { throw new Exception(string.Format("{0}{1}", "TypeMasters object missing from table TypeMasters:", newVoucherMasterModel.TrxType)); } //padding '0' char with len voucherNo = string.Format("{0}{1}", typeMaster.TrxCd, vouno.ToString().PadLeft(7, '0')); } else { voucherNo = newVoucherMasterModel.VouNo; } //Validate Debit / Credit mtot = newVoucherMasterModel.DrCr == "1" ? mtot - (decimal)newVoucherMasterModel.VouAmount : mtot + (decimal)newVoucherMasterModel.VouAmount; //Set corresponding voucher details voucherDetailModel = newVoucherMasterModel.VoucherDetails.FirstOrDefault(); if (null == voucherDetailModel) { throw new Exception(string.Format("{0}{1}", "Incomplete transaction. Dr/Cr mismatch:", voucherNo)); } //Check Dr/CR newVoucherMasterModel.VouNo = voucherNo; foreach (VoucherDetailModel items in newVoucherMasterModel.VoucherDetails) { mtot = items.DrCr == "1" ? mtot - (decimal)items.Amount : mtot + (decimal)items.Amount; items.VouNo = voucherNo; } if (mtot != 0) { throw new Exception(string.Format("{0}{1}", "Debit/Credit total mismatch for voucher :", voucherNo)); } VoucherMaster newVoucherMaster = _mapper.Map <VoucherMaster>(newVoucherMasterModel); await UnitOfWork.VoucherMasters.AddAsync(newVoucherMaster); //First ledger record ledger = new Ledger { CompCode = newVoucherMasterModel.CompCode, AccYear = newVoucherMasterModel.AccYear, VouNo = voucherNo, VouDate = newVoucherMasterModel.VouDate, TrxType = newVoucherMasterModel.TrxType, BilChq = newVoucherMasterModel.BilChq, ItemSr = itemSr, AccountId = newVoucherMasterModel.AccountId, DrCr = newVoucherMasterModel.DrCr, Amount = newVoucherMasterModel.VouAmount, CorrAccountId = voucherDetailModel.AccountId, VouDetail = voucherDetailModel.VouDetail, VoucherMaster = newVoucherMaster }; ledgersRec.Add(ledger); //Remaining ledger record foreach (VoucherDetailModel items in newVoucherMasterModel.VoucherDetails) { itemSr = itemSr + 1; items.ItemSr = itemSr; ledger = new Ledger { CompCode = items.CompCode, AccYear = items.AccYear, VouNo = voucherNo, VouDate = newVoucherMasterModel.VouDate, TrxType = newVoucherMasterModel.TrxType, BilChq = newVoucherMasterModel.BilChq, ItemSr = itemSr, AccountId = items.AccountId, DrCr = items.DrCr, Amount = items.Amount, CorrAccountId = newVoucherMasterModel.AccountId, VouDetail = items.VouDetail, VoucherMaster = newVoucherMaster }; //await UnitOfWork.Ledgers.AddAsync(ledger); ledgersRec.Add(ledger); } await UnitOfWork.Ledgers.AddRangeAsync(ledgersRec); //Update Voucher Master accountID Balance accountMaster = await UnitOfWork.AccountMasters.SingleOrDefaultAsync(a => a.CompCode == newVoucherMasterModel.CompCode && a.AccYear == newVoucherMasterModel.AccYear && a.AccountId == newVoucherMasterModel.AccountId); if (newVoucherMasterModel.DrCr == "1") { accountMaster.CurDr = accountMaster.CurDr.GetValueOrDefault() + newVoucherMasterModel.VouAmount; accountMaster.Closing = accountMaster.Opening.GetValueOrDefault() - accountMaster.CurDr.GetValueOrDefault() + accountMaster.CurCr.GetValueOrDefault(); } else { accountMaster.CurCr = accountMaster.CurCr.GetValueOrDefault() + newVoucherMasterModel.VouAmount; accountMaster.Closing = accountMaster.Opening.GetValueOrDefault() - accountMaster.CurDr.GetValueOrDefault() + accountMaster.CurCr.GetValueOrDefault(); } UnitOfWork.AccountMasters.Update(accountMaster); foreach (VoucherDetailModel items in newVoucherMasterModel.VoucherDetails) { accountMaster = await UnitOfWork.AccountMasters.SingleOrDefaultAsync(a => a.CompCode == items.CompCode && a.AccYear == items.AccYear && a.AccountId == items.AccountId); if (items.DrCr == "1") { accountMaster.CurDr = accountMaster.CurDr.GetValueOrDefault() + items.Amount; accountMaster.Closing = accountMaster.Opening.GetValueOrDefault() - accountMaster.CurDr.GetValueOrDefault() + accountMaster.CurCr.GetValueOrDefault(); } else { accountMaster.CurCr = accountMaster.CurCr.GetValueOrDefault() + items.Amount; accountMaster.Closing = accountMaster.Opening.GetValueOrDefault() - accountMaster.CurDr.GetValueOrDefault() + accountMaster.CurCr.GetValueOrDefault(); } UnitOfWork.AccountMasters.Update(accountMaster); } await UnitOfWork.Complete(); serviceResponse.Data = newVoucherMasterModel; } catch (Exception ex) { UnitOfWork.Dispose(); _logger.LogError(ex.StackTrace); serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }