private void KemaskiniKelulusan(string userId, ProcessStateType pst)
        {
            try
            {
                Data.PermohonanStok ps = new Data.PermohonanStok
                {
                    ProcessIdTemp = txtKelulusanProcessIdTemp.Text,
                    ProcessId = int.Parse(txtKelulusanProcessId.Text),
                    KuantitiDiluluskan = int.Parse(txtKelulusanKuantiti.Text),
                    Status = (int)(pst),
                    TarikhDiluluskan = DateTime.Now,
                    PegawaiKelulusanEmpSysId = int.Parse(txtKelulusanEmpSysId.Text),
                };

                string err = PermohonanStokMethods.SP_UpdatePermohonanStokKelulusan(int.Parse(userId), ps);

                if (err == string.Empty)
                {
                    cbpKelulusan.JSProperties["cpErrMsg"] = string.Empty;
                }
                else
                {
                    string errMsg = ConfigurationManager.AppSettings["ErrorMessageStaringSentenceDBError"].ToString();
                    errMsg = errMsg.Replace("BR", "<br><br>");
                    cbpKelulusan.JSProperties["cpErrMsg"] = errMsg + " " + err;
                }
            }
            catch (Exception err)
            {
                string errMsg = ConfigurationManager.AppSettings["ErrorMessageStaringSentenceCaughtByExceptions"].ToString();
                errMsg = errMsg.Replace("BR", "<br><br>");
                cbpKelulusan.JSProperties["cpErrMsg"] = errMsg + " " + err.Message;
            }
        }
        private void KemaskiniPermohonan(string userId)
        {
            try
            {
                Data.PermohonanStok ps = new Data.PermohonanStok
                {
                    ProcessId = int.Parse(txtNoPermohonan.Text),
                    PengeluaranKuantiti = int.Parse(txtPermohonanKuantitiDiKeluarkan.Text),
                    Status = (int)ProcessStateType.Pengeluaran,
                    PengeluaranTarikh = DateTime.Now,
                    PengeluaranEmpSysId = (int)glPengeluarNama.Value,
                    PengeluaranCatatan = mmPermohonanCatatan.Text
                };

                string err = PermohonanStokMethods.SP_UpdatePermohonanStokPengeluaran(int.Parse(userId), ps);

                if (err == string.Empty)
                {
                    cbp.JSProperties["cpErrMsg"] = string.Empty;
                }
                else
                {
                    string errMsg = ConfigurationManager.AppSettings["ErrorMessageStaringSentenceDBError"].ToString();
                    errMsg = errMsg.Replace("BR", "<br><br>");
                    cbp.JSProperties["cpErrMsg"] = errMsg + " " + err;
                }
            }
            catch (Exception err)
            {
                string errMsg = ConfigurationManager.AppSettings["ErrorMessageStaringSentenceCaughtByExceptions"].ToString();
                errMsg = errMsg.Replace("BR", "<br><br>");
                cbp.JSProperties["cpErrMsg"] = errMsg + " " + err.Message;
            }
        }
        private void SaveHeader(string user)
        {
            try
            {
                Data.PermohonanStok ps = new Data.PermohonanStok
                {
                    ProcessIdTemp = txtProcessIdTemp.Text,
                    PermohonanTujuan = mmTujuan.Text,
                    PermohonanTarikhDiKehendaki = deTarikhDiperlukan.Date,
                    PtjDiPohon = (int)glPtjDiPohon.Value,
                    StorDiPohon = (int)glPtjDiPohon.Value,
                    StokDiPohon = (int)glStokDiPohon.Value,
                    PermohonanKuantitiDiPohon = int.Parse(txtKuantitiDiPohon.Text),
                    PermohonanToJenis = cbPenerima.SelectedIndex
                };

                if (cbPenerima.SelectedIndex == 0)
                {
                    ps.PermohonanToPtj = (int)glPermohonanToPtj.Value;
                    ps.PermohonanToStor = (int)glPermohonanToStor.Value;
                }
                else
                {
                    ps.PermohonanToNama = (int)glPermohonanToNama.Value;
                }

                string err = PermohonanStokMethods.SP_UpdatePermohonanStok(int.Parse(user), ps);

                if (err == string.Empty)
                {
                    cbpHeader.JSProperties["cpErrMsg"] = string.Empty;
                }
                else
                {
                    string errMsg = ConfigurationManager.AppSettings["ErrorMessageStaringSentenceDBError"].ToString();
                    errMsg = errMsg.Replace("BR", "<br><br>");
                    cbpHeader.JSProperties["cpErrMsg"] = errMsg + " " + err;
                }
            }
            catch (Exception err)
            {
                string errMsg = ConfigurationManager.AppSettings["ErrorMessageStaringSentenceCaughtByExceptions"].ToString();
                errMsg = errMsg.Replace("BR", "<br><br>");
                cbpHeader.JSProperties["cpErrMsg"] = errMsg + " " + err.Message;
            }
        }